package Week9;

import java.util.Scanner;
import java.util.Set;
import java.util.TreeSet;

public class Main2 {

	public static void main(String[] args) {
		Set<String> words = new TreeSet<>();
		Scanner sc = new Scanner (System.in);
		int i=0;
		
		while(true){
			String word = sc.next();
			if(word.equals("!!!!!"))
				break;
			words.add(word);
			
		}
	
		
		System.out.println(words.size());
		for(String string:words){
			if(i<10){
				System.out.println(string);
				i++;
			}
		}
		sc.close();
	}
	
}

